package com.beep.erp.model.stockIn;

import com.beep.erp.common.base.BaseBean;
import com.beep.erp.common.bean.StockInListBean;
import com.beep.erp.common.bean.StockListBean;
import com.beep.erp.http.HttpExceptionHandle;
import com.beep.erp.http.HttpResultSubscriber;
import com.beep.erp.model.addinstock.SaveStockBody;
import com.beep.erp.model.stockdetail.StockDetailContract;

import rx.schedulers.Schedulers;

/**
 * Created by Jolly on 2018/9/2.
 */

public class StockInListPresenter extends StockInListContract.Presenter {
    @Override
    public void getStockInList(String sign, String timeStamp, int pageSize, int pageNo) {
        mRxManage.add(mModel.getStockInList(sign, timeStamp, pageSize, pageNo).unsubscribeOn(Schedulers.io()).subscribe(new HttpResultSubscriber<StockInListBean>() {
            @Override
            public void onError(HttpExceptionHandle.ResponeThrowable e) {
                mView.hideLoading();
                mView.showMessage(e.ErrorInfo);
            }

            @Override
            public void onNext(StockInListBean stockListBean) {
                mView.hideLoading();
                mView.getStockInList(stockListBean);
            }
        }));
    }

    @Override
    public void onStart() {
        mView.getDate();
    }

}
